# -*- coding: UTF-8 -*-
"""
@author: tgy
@file: 7.7 匿名函数捕获变量值.py
@time: 2021/02/02
"""

x = 10

def test():
    print('789')
    return x

# 形参在进行默认值赋值是在函数对象创建时进行当
a = lambda y,x=test(): x + y

print('1111')

x = 20
# 当运行时，去全局名称空间查找x，这时当x = 20。所以输出 50
print(a(30))

if __name__ == '__main__':
    pass
